home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tclX6.4c / dist / tests / clock.test < prev    next >
Encoding:
Text File  |  1992-11-07  |  2.2 KB  |  70 lines

  1. #
  2. # clock.test
  3. #
  4. # Tests for the getclock, fmtclock and convertclock commands.
  5. #---------------------------------------------------------------------------
  6. # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: clock.test,v 2.1 1992/11/07 20:36:55 markd Exp $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. if {[info procs test] != "test"} then {source testlib.tcl}
  20.  
  21. # Try  getclock, hard to test the result.
  22.  
  23. test clock-1.1 {getclock tests} {
  24.     list [catch {set clockval [getclock];expr $clockval+1} msg]
  25. } {0}
  26. test clock-1.2 {getclock tests} {
  27.     list [catch {getclock 1990} msg] $msg
  28. } {1 {wrong # args: getclock}}
  29.  
  30. # Test fmtclock
  31.  
  32. test clock-2.1 {fmtclock tests} {
  33.     set clockval 657687766
  34.     fmtclock $clockval {%a %b %d %I:%M:%S %p %Y} GMT
  35. } {Sun Nov 04 03:02:46 AM 1990}
  36.  
  37. test clock-2.2 {fmtclock tests} {
  38.     list [catch {fmtclock} msg] $msg
  39. } {1 {wrong # args: fmtclock clockval [format] [GMT|{}]}}
  40.  
  41.  
  42. # Test convertclock
  43.  
  44. test clock-3.1 {convertclock tests} {
  45.     list [catch convertclock msg] $msg
  46. } {1 {wrong # args: convertclock dateString [GMT|{}] [baseclock]}}
  47.  
  48. test clock-3.2 {convertclock tests} {
  49.     fmtclock [convertclock "14 Feb 92" GMT] {%D %r} GMT
  50. } {02/14/92 12:00:00 AM}
  51.  
  52. test clock-3.3 {convertclock tests} {
  53.     fmtclock [convertclock "Feb 14, 1992 12:20 PM" GMT] {%D %r} GMT
  54. } {02/14/92 12:20:00 PM}
  55.  
  56. test clock-3.5 {convertclock tests} {
  57.     fmtclock [convertclock "Feb 14, 1992 12:20 PM" {GMT} 319363200] {%D %r} GMT
  58. } {02/14/92 12:20:00 PM}
  59.  
  60. test clock-3.6 {convertclock tests} {
  61.     set clock [convertclock "Oct 23,1992 15:00"]
  62.     fmtclock $clock {%b %d,%Y %H.%M}
  63. } {Oct 23,1992 15.00}
  64.  
  65. test clock-3.7 {convertclock tests} {
  66.     set clock [convertclock "Oct 23,1992 15:00 GMT"]
  67.     fmtclock $clock {%b %d,%Y %H.%M GMT} GMT
  68. } {Oct 23,1992 15.00 GMT}
  69.  
  70.